/*
 * IPAddress.h
 *
 *  Created on: Mar 14, 2011
 *      Author: sms103
 */

#ifndef IPADDRESS_H_
#define IPADDRESS_H_

#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>


class IPAddress {
public:
	//constructs an ip address for localhost by default
	IPAddress();

	//different ways to set the ip address
	//sets ip addr from a string of form xxx.xxx.xxx.xxx
	bool setAddrIPString(const char *ip_str);

	//sets ip addr from a hostname string
	bool setAddrHostname(const char *hostname);

	//sets ip addr from an in_addr struct
	bool setAddrInAddr(struct in_addr * ip4addrStruct);

	struct in_addr *getInAddr();

	virtual ~IPAddress();

private:
	struct in_addr sin_addr;
};

#endif /* IPADDRESS_H_ */
